# pylint: option block-disable-msg
"""
Profile the developer UI.
"""

import profile, pstats, os, os.path
import pygame
import guimain

def f8_i(x): # pylint: option block-disable-msg
    """using an integer clock, so lose the floating-point formatting."""

    return "%8s" % str(x)

if __name__ == "__main__": # pylint: option block-disable-msg
    pstats.f8 = f8_i
    
    # Create a profiler
    pr = profile.Profile(pygame.time.get_ticks)
    
    # Run the game
    pr.run('guimain.run()')
    
    # Save the stats to disk
    profilePath = os.path.join(os.environ["PGAME_LOGS"], "pgame.prof")
    pr.dump_stats(profilePath)
    
    # And print them out.
    s = pstats.Stats(pr)
    s.strip_dirs().sort_stats('time')
    s.print_stats()
    
